<!doctype html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>微信管理</title>

  <!-- Disable tap highlight on IE -->
  <meta name="msapplication-tap-highlight" content="no">

  <link href="styles/bootstrap.min.css" rel="stylesheet">
  <link href="styles/dashboard.css" rel="stylesheet">
</head>

<body>
  <!-- Add your site or app content here -->
  <nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
        <a class="navbar-brand" href="/">微信管理</a>
      </div>
      <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav navbar-right">
          <li><a href="/">首页</a></li>
          <li><a href="/userinfo.html">微信号管理</a></li>
          <li><a href="/ads_list.html">广告列表</a></li>
          <li><a href="/logout.html">登出</a></li>
        </ul>
      </div>
    </div>
  </nav>

  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-3 col-md-2 sidebar">
        <ul class="nav nav-sidebar">
          <li class="active"><a href="#">Overview <span class="sr-only">(current)</span></a></li>
        </ul>
      </div>
      <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <h1 class="page-header">首页</h1>


        <div class="table-responsive">
          <table class="table table-striped">
            <thead>
              <tr>
                <th>#</th>
                <th>分类</th>
                <th>新闻</th>
                <th>广告</th>
              </tr>
            </thead>
            <tbody id='list'></tbody>
          </table>
        </div>
      </div>
    </div>
  </div>

  <!-- Built with love using Web Starter Kit -->
  <script src="scripts/pace.min.js"></script>
  <script src="scripts/jquery.min.js"></script>
  <script src="scripts/bootstrap.min.js"></script>
  <script src="scripts/config.js"></script>
  <script>
    checkLogin();

    $.get(server_host + '/get_list', function(data) {
      if (data.info.code == 200) {
        var items = data.item;
        var tbody = '';
        for (var i = 0; i < items.length; i++) {
          tbody += "<tr>"
          tbody += "<td>" + (i + 1) + "</td>"
          tbody += "<td>" + items[i].classify_name + "</td>"
          tbody += "<td><a href='/news_list.html?cid=" + items[i].classify_id + "'>列表</a></td>"
          tbody += "<td><a href='/ads_list.html?cid=" + items[i].classify_id + "'>列表</a></td>"
          tbody += "</tr>"
        }
        $('#list').append(tbody);
      }
    }, 'json')
  </script>
</body>

</html>